package day12;


import java.util.Scanner;

public class TestComputer {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Computer a = new Computer();
        SoftWare b = new Sys();

        a.setStart("已关机");
        a.setInstall("未安装");
        a.setFormat("未格式化");
        while (true) {
            System.out.println("1:格式化");
            System.out.println("2:安装操作系统");
            System.out.println("3:启动");
            System.out.println("4:安装软件");
            System.out.println("5:安装下载软件");
            System.out.println("6:查看各盘情况");
            System.out.println("9:退出");
            System.out.println("请输入\"C:\\Program Files\\Java\\jdk1.8.0_291\\bin\\java.exe\" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:55755,suspend=y,server=n -javaagent:C:\\Users\\Dell\\.IntelliJIdea2018.2\\system\\captureAgent\\debugger-agent.jar=file:/C:/Users/Dell/AppData/Local/Temp/capture.props -Dfile.encoding=UTF-8 -classpath \"C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\charsets.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\deploy.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\access-bridge-64.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\cldrdata.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\dnsns.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\jaccess.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\jfxrt.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\localedata.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\nashorn.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\sunec.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\sunjce_provider.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\sunmscapi.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\sunpkcs11.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\ext\\zipfs.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\javaws.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\jce.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\jfr.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\jfxswt.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\jsse.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\management-agent.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\plugin.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\resources.jar;C:\\Program Files\\Java\\jdk1.8.0_291\\jre\\lib\\rt.jar;D:\\out\\production\\PraTice面向对象;D:\\out\\production\\java高级;D:\\out\\production\\TestOop;D:\\out\\production\\OOPtest;D:\\IntelliJ IDEA 2018.2.8\\lib\\idea_rt.jar\" extend_.ExtendsDetail\n" +
                    "Connected to the target VM, address: '127.0.0.1:55755', transport: 'socket'\n" +
                    "Base（）。。。\n" +
                    "1000您的选择");
            int chioce = input.nextInt();
            switch (chioce) {
                case 1:
                    if (a.getStart().equals("已开机")) {
                        System.out.println("计划分为几个盘");
                        int sum = input.nextInt();

                        for (int i = 0; i < sum; i++) {
                            Disk disk = new Disk();
                            System.out.println("请输入第" + (i + 1) + "个盘符");
                            disk.setType(input.next());
                            System.out.println("请输入" + (i + 1) + "个盘符的大小");
                            disk.setSize(input.nextInt());
                        }
                        System.out.println("格式化成功");

                    } else {
                        System.out.println("电脑未开机请先启动");
                    }
                    a.setFormat("已格式化");
                    break;

                case 2:
                    if (a.getStart().equals("已开机") && a.getFormat().equals("已格式化")) {
                        System.out.println("有以下操作系统可供选择");
                        ((Sys) b).show();
                        System.out.println("请输入您的选择");
                        String h = input.next();
                        SoftWare softWare1 = new Sys();
                        new Sys().setName(h);
                        System.out.println("请输入您要安装的盘符");
                        String f = input.next();
                        a.add(f, softWare1);
                        a.setInstall("已安装系统");
                        System.out.println("安装成功");
                    }else {
                        System.out.println("系统安装失败");
                    }
                    break;
                case 3:
                    a.start();
                    a.setStart("已开机");
                    break;
                case 4:
                    if (a.getStart().equals("已开机") && a.getFormat().equals("已格式化") && a.getInstall().equals("已安装系统")) {
                        System.out.println("请输入您要下载的软件");
                        String s = input.next();
                        SoftWare softWare = new SoftWare();
                        new SoftWare().setName(s);
                        System.out.println("请选择您要安装到哪个盘符");
                        String v = input.next();
                        a.add(v, softWare);
                        System.out.println("安装成功");
                    } else {
                        System.out.println("安装软件失败，请重新操作");
                    }
                    break;
                case 5:
                    if (a.getStart().equals("已开机") && a.getFormat().equals("已格式化") && a.getInstall().equals("已安装系统")) {
                        System.out.println("请输入您要下载的软件");
                        String n= input.next();
                        SoftWare softWare3= new DowSoftWare();
                        new DowSoftWare().setName1(n);
                        System.out.println("请选择您要安装到哪个盘符");
                        String v = input.next();
                        a.add(v, softWare3);
                        ((DowSoftWare) softWare3).dol();
                    } else {
                        System.out.println("安装下载软件失败，请重新操作");
                    }
                    break;
                case 6:
                    a.showsoft();
                    break;
                default:
                    break;
            }
            if (chioce == 9) {
                System.out.println("退出系统");
                break;
            }
        }
    }
}
